<?php include $this->admin_tpl("header"); ?>
<link rel="stylesheet" type="text/css" href="<?php echo JS_PATH;?>EasyUI/themes/haidaoblue/easyui.css">
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/hd_default_config.js"></script>
<div class="content">
    <div class="site">
        <?php echo C('site_name')?> <a href="#">返利中心</a> > 返利配置
    </div>
    <span class="line_white"></span>
    <div class="install mt10 reg_login">
    <dl>
        <dd>
            <form name="form" id="fanli_form" method="post" action="<?php echo U('Rebate/return_money') ?>">
                <ul class="web p0">
                    <li>
                        <strong>总营业额：</strong>
                        <b><?php echo $amount_all;?>元</b>
                        <span style="margin-left:-1px" class="red">系统开业至今的总营业额</span>
                    </li>
                     <li>
                        <strong>平台总返利：</strong>
                        <b><?php echo $return_money==""?"0.00":$return_money;?>元</b>
                        <span style="margin-left:-1px" class="red">系统开业至今的总返利金额</span>
                    </li>
                    <li>
                        <strong>昨日线下商家营业额：</strong>
                        <b><?php echo $amount_yesterday;?>元</b>
                        <span style="margin-left:-1px" class="red">昨日线下商家营业额</span>
                    </li>
                    <li>
                        <strong>赠送积分方式：</strong>
                        <b class="u_typs_radio">
                            <label><input type="radio" name="return_type" id="return_type" value="1"/> 固定分红 </label>
                            <label><input type="radio" name="return_type" id="return_type" value="2"  checked="checked"/> 百分比 </label>
                        </b>
                        <span style="margin-left:-1px" class="red">选择赠送积分方式</span>
                    </li>
                     <li>
                        <strong>系统待返赠送权数：</strong><?php echo $return_num;?><span style="margin-left:2px" class="red">个</span>
                    </li>
                     <li class="u_type_1" style="display:none">
                        <strong>强制每个赠送权价格：</strong>
                        <input type="text" value="0" class="text_input" name="return_money" /><span style="margin-left:2px">元</span>
                    </li>
                    <li class="u_type_2">
                        <strong>商家营业额用于返现的百分比：</strong>
                        <input type="hidden" value="<?php
                         $num=($amount_yesterday*0.01)/$return_num;
                         echo floor($num*100)/100;?>" class="text_input" name="return_per10" id="return_per10" />
                        <input type="text" value="1" class="text_input" name="return_per" id="return_per" /><span style="margin-left:2px">%</span>
                    </li>
                    <li class="u_type_2">
                        <strong>每个赠送权价格：</strong>
                        <input type="text" value="<?php
                        $num=($amount_yesterday*0.01)/$return_num;
                         echo floor($num*100)/100;?>" class="text_input" name="return_money2" id="return_money2" readonly="readonly" style="background:#CCC" /><span style="margin-left:2px" id="infosss">元 (昨日线下商家营业额)<?php echo $amount_yesterday;?>元 * 1%（商家营业额的1%）/ <?php echo $return_num;?>(赠送权个数)=<?php  echo floor($num*100)/100;?>(每个赠送权金额)</span>
                    </li>
                </ul>
          
                <script type="text/javascript">
                Number.prototype.toFixed2=function (){
                        return parseFloat(this.toString().replace(/(\.\d{2})\d+$/,"$1"));
                    }
                $(function(){
                    $(".button_search").click(function(){
                        $.messager.confirm('确认','<font class="red">您确认想要进行今日赠送吗？此操作不可逆转，进行过程中请不要关闭页面！</font>',function(r){
                            if (r){
                                $("#fanli_form").submit();
                            }
                        }); 
                    })
                    
                    $('#return_per').bind("change",function(){
                        var per=parseFloat($(this).val())/100*100;
                        var money=parseFloat($("#return_per10").val())*per;
                        money=money.toFixed2();
                        $("#return_money2").val(money);
                        $("#infosss").text('元 (昨日线下商家营业额)<?php echo $amount_yesterday;?>元 * '+$(this).val()+'%（商家营业额的'+$(this).val()+'%） / <?php echo $return_num;?>(分红权个数)='+money+'(每个分红权金额)');
                    });
                    $(".u_typs_radio input").click(function(){
                        if($(this).val()==2){
                            $(".u_type_1").hide()
                            $(".u_type_2").show()
                        }else{
                            $(".u_type_2").hide()   
                            $(".u_type_1").show()
                        }
                    })  
                })
                </script>
            </form>
        </dd>
    </dl>
    <?php include $this->admin_tpl("copyright"); ?>
    <div class="clear"></div>
</div>
<script>  

    //切换
    $(window).load(function() {
        var tabTitle = ".reg_login dt a";
        var tabContent = ".reg_login dd";
        $(tabTitle).bind("click", function() {
            $(this).siblings("a").removeClass("hover").end().addClass("hover");
            var index = $(tabTitle).index($(this));
            $(tabContent).eq(index).show().siblings(tabContent).hide();
            $(window).resize();
        });
    });
</script>